﻿using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Html;

namespace WebSite.ViewModels.Fields
{
    public class TextAreaField : FieldBase
    {
        private readonly string m_Value;
        private readonly int m_Rows;
        private readonly int m_Cols;

        public TextAreaField(string caption, string name, string value, int rows = 5, int cols = 50) 
            : base(caption, name, value, true)
        {
            m_Value = value;
            m_Rows = rows;
            m_Cols = cols;
        }

        public override IHtmlString Render(HtmlHelper htmlHelper)
        {
            return htmlHelper.TextArea(Name, m_Value, m_Rows, m_Cols, null);
        }
    }
}